Optimal. Leaf size=185 \[ -\frac {(-7 B+i A) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}-\frac {-15 B+i A}{16 a^4 d (1+i \tan (c+d x))}+\frac {x (A+15 i B)}{16 a^4}-\frac {B \log (\cos (c+d x))}{a^4 d}+\frac {(-B+i A) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac {(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.51, antiderivative size = 185, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 6, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {3595, 3589, 3475, 12, 3526, 8} \[ -\frac {(-7 B+i A) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}-\frac {-15 B+i A}{16 a^4 d (1+i \tan (c+d x))}+\frac {x (A+15 i B)}{16 a^4}-\frac {B \log (\cos (c+d x))}{a^4 d}+\frac {(-B+i A) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac {(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 12
Rule 3475
Rule 3526
Rule 3589
Rule 3595
Rubi steps
\begin {align*} \int \frac {\tan ^4(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^4} \, dx &=\frac {(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac {\int \frac {\tan ^3(c+d x) (4 a (i A-B)+8 i a B \tan (c+d x))}{(a+i a \tan (c+d x))^3} \, dx}{8 a^2}\\ &=\frac {(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac {(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}+\frac {\int \frac {\tan ^2(c+d x) \left (-12 a^2 (A+3 i B)-48 a^2 B \tan (c+d x)\right )}{(a+i a \tan (c+d x))^2} \, dx}{48 a^4}\\ &=-\frac {(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac {(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}-\frac {\int \frac {\tan (c+d x) \left (-24 a^3 (i A-7 B)-192 i a^3 B \tan (c+d x)\right )}{a+i a \tan (c+d x)} \, dx}{192 a^6}\\ &=-\frac {(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac {(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}+\frac {i \int \frac {24 a^4 (A+15 i B) \tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{192 a^7}+\frac {B \int \tan (c+d x) \, dx}{a^4}\\ &=-\frac {B \log (\cos (c+d x))}{a^4 d}-\frac {(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac {(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}+\frac {(i A-15 B) \int \frac {\tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{8 a^3}\\ &=-\frac {B \log (\cos (c+d x))}{a^4 d}-\frac {(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac {(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}-\frac {i A-15 B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}+\frac {(A+15 i B) \int 1 \, dx}{16 a^4}\\ &=\frac {(A+15 i B) x}{16 a^4}-\frac {B \log (\cos (c+d x))}{a^4 d}-\frac {(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac {(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}-\frac {i A-15 B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 1.44, size = 195, normalized size = 1.05 \[ \frac {\sec ^4(c+d x) (16 (21 B-4 i A) \cos (2 (c+d x))+3 \cos (4 (c+d x)) (8 A d x+i A-128 B \log (\cos (c+d x))+120 i B d x-B)+32 A \sin (2 (c+d x))+24 i A d x \sin (4 (c+d x))+3 A \sin (4 (c+d x))+36 i A+288 i B \sin (2 (c+d x))+3 i B \sin (4 (c+d x))-360 B d x \sin (4 (c+d x))-384 i B \sin (4 (c+d x)) \log (\cos (c+d x))-96 B)}{384 a^4 d (\tan (c+d x)-i)^4} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.60, size = 117, normalized size = 0.63 \[ \frac {{\left (24 \, {\left (A + 31 i \, B\right )} d x e^{\left (8 i \, d x + 8 i \, c\right )} - 384 \, B e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + {\left (-48 i \, A + 312 \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (36 i \, A - 96 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-16 i \, A + 24 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 3 i \, A - 3 \, B\right )} e^{\left (-8 i \, d x - 8 i \, c\right )}}{384 \, a^{4} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 2.18, size = 154, normalized size = 0.83 \[ -\frac {\frac {12 \, {\left (-i \, A - B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{4}} - \frac {12 \, {\left (-i \, A + 31 \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{4}} - \frac {25 i \, A \tan \left (d x + c\right )^{4} - 775 \, B \tan \left (d x + c\right )^{4} - 260 \, A \tan \left (d x + c\right )^{3} + 1924 i \, B \tan \left (d x + c\right )^{3} + 522 i \, A \tan \left (d x + c\right )^{2} + 1866 \, B \tan \left (d x + c\right )^{2} + 388 \, A \tan \left (d x + c\right ) - 772 i \, B \tan \left (d x + c\right ) - 103 i \, A - 103 \, B}{a^{4} {\left (\tan \left (d x + c\right ) - i\right )}^{4}}}{384 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.23, size = 244, normalized size = 1.32 \[ \frac {B \ln \left (\tan \left (d x +c \right )+i\right )}{32 d \,a^{4}}+\frac {i A \ln \left (\tan \left (d x +c \right )+i\right )}{32 d \,a^{4}}+\frac {i A}{8 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{4}}-\frac {B}{8 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{4}}-\frac {49 i B}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )}-\frac {15 A}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )}+\frac {31 B}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {17 i A}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{2}}+\frac {3 i B}{4 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{3}}+\frac {7 A}{12 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{3}}-\frac {i \ln \left (\tan \left (d x +c \right )-i\right ) A}{32 d \,a^{4}}+\frac {31 \ln \left (\tan \left (d x +c \right )-i\right ) B}{32 d \,a^{4}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.77, size = 178, normalized size = 0.96 \[ \frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (-\frac {29\,B}{4\,a^4}+\frac {A\,7{}\mathrm {i}}{4\,a^4}\right )-{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {15\,A}{16\,a^4}+\frac {B\,49{}\mathrm {i}}{16\,a^4}\right )-\frac {A\,1{}\mathrm {i}}{3\,a^4}+\frac {7\,B}{4\,a^4}+\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {61\,A}{48\,a^4}+\frac {B\,97{}\mathrm {i}}{16\,a^4}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^4-{\mathrm {tan}\left (c+d\,x\right )}^3\,4{}\mathrm {i}-6\,{\mathrm {tan}\left (c+d\,x\right )}^2+\mathrm {tan}\left (c+d\,x\right )\,4{}\mathrm {i}+1\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )}{32\,a^4\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (A+B\,31{}\mathrm {i}\right )\,1{}\mathrm {i}}{32\,a^4\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 7.06, size = 366, normalized size = 1.98 \[ - \frac {B \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a^{4} d} + \begin {cases} \frac {\left (\left (24576 i A a^{12} d^{3} e^{12 i c} - 24576 B a^{12} d^{3} e^{12 i c}\right ) e^{- 8 i d x} + \left (- 131072 i A a^{12} d^{3} e^{14 i c} + 196608 B a^{12} d^{3} e^{14 i c}\right ) e^{- 6 i d x} + \left (294912 i A a^{12} d^{3} e^{16 i c} - 786432 B a^{12} d^{3} e^{16 i c}\right ) e^{- 4 i d x} + \left (- 393216 i A a^{12} d^{3} e^{18 i c} + 2555904 B a^{12} d^{3} e^{18 i c}\right ) e^{- 2 i d x}\right ) e^{- 20 i c}}{3145728 a^{16} d^{4}} & \text {for}\: 3145728 a^{16} d^{4} e^{20 i c} \neq 0 \\x \left (- \frac {A + 31 i B}{16 a^{4}} - \frac {i \left (i A e^{8 i c} - 4 i A e^{6 i c} + 6 i A e^{4 i c} - 4 i A e^{2 i c} + i A - 31 B e^{8 i c} + 26 B e^{6 i c} - 16 B e^{4 i c} + 6 B e^{2 i c} - B\right ) e^{- 8 i c}}{16 a^{4}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (- A - 31 i B\right )}{16 a^{4}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________